// 接口请求
// 导入axios
import request from './request.js';

// 请求登录
export const reqLogin = (username,pwd)=>{
    return request({
        url:'/admin/login',
        method:'POST',
        data:{
            username,
            pwd 
        }
    });
}

// 请求登录用户信息
export const reqLoginUser = ()=>request('/admin/info');


// 退出登录
export const reqLogout = ()=> request('/admin/logout');


// 获取用户列表页
export const reqUserList = (page,limit)=>request({
    url:`/admin/user/${page}/${limit}`,
    method:'GET'
});

// 删除用户
export const deleteUser = (id)=>request({
    method:'delete',
    url:`/admin/user/${id}`
});

// 添加用户
// req
// {
//     usernma:'',
//     pwd:123,
//     profile:'123'
// }
export const reqAddUser = (req)=>request({
    url:'/admin/user',
    method:'POST',
    data:req
})


// 更新用户
export const reqUpdataUser = (req)=>request({
    method:'PUT',
    url:'/admin/user',
    data:req
})


// 获取单个用户信息
export const reqUserInfo = (id) => request('/admin/user?id='+id)
